class_name AttackCard
extends Card

var upgraded_damage: int

func _init(card_id: String, card_name: String, card_desc: String, card_cost: int, card_damage: int, card_rarity: int = 0, character_type: GameData.CharacterType = GameData.CharacterType.XU, image: String = ""):
	super._init(card_id, card_name, card_desc, card_cost, GameData.CardType.ATTACK, card_rarity, character_type, image, card_damage, 0)
	upgraded_damage = card_damage + 3
	# 设置详细描述
	detailed_description = card_desc + "\n对敌人造成 " + str(damage) + " 点伤害。"

func on_play() -> void:
	# 对当前目标造成伤害
	var game_data = GameData.get_instance()
	if game_data.current_enemies.size() > 0:
		var target = game_data.current_enemies[0]  # 默认攻击第一个敌人
		target.take_damage(damage)

func upgrade() -> void:
	damage = upgraded_damage
	description = description.replace(str(damage - 3), str(damage))

func get_description() -> String:
	return description + " 造成 " + str(damage) + " 点伤害。"
